<!-- add by lty 20181222 -->

<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>服务评论</title>
    <meta name="viewport" content="initial-scale=1, maximum-scale=1">
    <link rel="shortcut icon" href="/favicon.ico">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">

    <link rel="stylesheet" href="http://g.alicdn.com/msui/sm/0.6.2/css/sm.min.css">
    <link rel="stylesheet" href="css/style.css">
    <link rel="stylesheet" href="css/common.css">
    <link rel="stylesheet" href="css/serverDetail.css">
      <!-- 插件js -->
	<script src="../js/zepto.js"></script>
	<script src="../js/sm.js" ></script>
	<script src="../js/sm-extend.js" ></script>
	<script src="../js/request.js"></script>
	<script src="js/jquery/3.2.1/jquery.min.js"></script>
	<script src="../../js/common.js"></script>
	
    <script type="text/javascript">
	window.$$=window.Zepto = Zepto;
	</script>
	<style type="text/css">
	.tolink{
	text-align: -webkit-center;
    margin-top: 10px;
    font-size: 15px;
    color: cornflowerblue;
    cursor: pointer;
    border: 1px solid #ddd;
    width: 80%;
    border-radius: 8px;
    margin-left: 10%;
    padding : 10px;
    background:  #FF9900;
    color: #fff;
	}
	</style>
  </head>
  <body>
    <div class="page">

      <!-- 主体内容 -->
      <div class="T_content">
        
        <!-- 保洁套餐 -->
        <div class="clean--detail">
          <p class="clean_detail--title">保洁套餐</p>
          <div class="clean_detail--goods cl">
            <p class="goods-img fl">
              <img id="logo" src="images/reportList/i-f7.png" alt="">
            </p>
            <div class="detail--goods_text fl">
              <p class="p1">日常保洁套餐</p>
              <p class="p2 esp2">一月四次日常保洁，轻松享受干净家居生活</p>
            </div>
          </div>
          <div class="goods_detail--list">
            <ul>
              <li class="cl">
                <span class="sp01 fl">套餐包含服务小时</span>
                <span class="sp02 fr count"><!-- 12份 --></span>
              </li>
              <li class="cl">
                <span class="sp01 fl">金额</span>
                <span class="sp02 fr money"><!-- 343元 --></span>
              </li>
              <li class="cl">
                <span class="sp01 fl">下单日期</span>
                <span class="sp02 fr date"><!-- 2018.10.25 --></span>
              </li>
            </ul>
            <span class="address--name">姓名</span>
            <span class="address--phone">15626486938</span>
            <p class="address--detail esp1">珠海高新区香山小区7栋1803室</p>
          </div>
          
        </div>
      <ul>
      	<li>
			<textarea rows="3" cols="4" class="textarea" placeholder="想说些什么..." style="width: 96%;margin-left: 2%;margin-top: 11px;padding: 6px;" id="content"></textarea>
		</li>
      </ul>
        <div class="tolink" onclick="insertServiceComment()">发表</div>
      </div>
    </div>
    <script type="text/javascript">
    var orderId = Request.queryString("orderId");
    var path = "/LanJuPublic";
    $(function(){
    	queryPackageDetail();
    })
    var statusArr = {
    	"0":"待接单",
    	"1":"等待服务",
    	"2":"服务中",
    	"3":"已完成"
    }
    function queryPackageDetail(){
    	$.ajax({
			url : path+"/service/queryPackageDetail.do",
			data : {
				"orderId": orderId,
			},
			type : "GET",
			dataType : 'json',
			cache : false,
			success : function(ret){
				if(ret.result = true){
					var serviceCount;
					if(ret.packageList && ret.packageList.length>0){
						$.each(ret.packageList,function(i,n){
							$(".address--name").text("客户姓名："+n.nickName);
							$(".address--phone").text(n.phone);
							$(".address--detail").text("客户地址："+n.address);
							$(".p1").text(n.serviceName);
							$(".p2").text(n.serviceDesc);
							$("#logo").attr("src",n.imgUrl);
							if(n.chargesType == 1){
								serviceCount = parseInt(n.serviceCount)*4;
								$(".count").text(parseInt(ret.order[0].hours)+"小时");
								$(".number").text(parseInt(n.serviceCount)*4);
							}else if (n.chargesType == 2){
								serviceCount = parseInt(n.serviceCount);
								$(".count").text(ret.order[0].hours+"小时");
								$(".number").text(n.serviceCount);
							}
							$(".money").text(n.price);
							$(".date").text(formatDate(n.createTime));
						})
					}
					var done = 0;
					
				}
			}
		})
    }
    function insertServiceComment(){
    	if( $("#content").val() ==""){
    		$$.toast("请填写评论");
    		return false;
    	}
    	$.ajax({
			url : path+"/serviceComment/insertServiceComment.do",
			data : {
				"content" : $("#content").val()
			},
			type : "GET",
			dataType : 'json',
			cache : false,
			success : function(ret){
				if(ret.result = true){
					
				}
			}
		})
     }
    function formatDate(a) { 
    	var now= new Date(a);   
    	var year=now.getFullYear(); 
    	var month=now.getMonth()+1; 
    	var date=now.getDate(); 
    	var hour=now.getHours(); 
    	var minute=now.getMinutes(); 
    	var second=now.getSeconds(); 
    	return year+"-"+month+"-"+date+" "+hour+":"+minute+":"+second;   
    	} 
    $(".tolink").click(function (){
    	
    })
    </script>
  </body>
</html>